#ifndef _LOG_H
#define _LOG_H

#include <stdio.h>
#include <time.h>
#include <stdarg.h>  
#include <string.h>  
#include <stdlib.h>  

//------------------------------------------------------------------------------
// Log
// Log class. Allows to us print messages to a log file or to console.
// This is a singleton class. All objects share the same log. 
//------------------------------------------------------------------------------
class Log{

 private:
  bool m_bFileMode;   // true: writes to a file - false:to screen
  bool m_bDebugMode;  // true: writes debug messages
  bool m_bSpecialDebugMode; // true: writes special debug messages
  bool m_bErrorMode;  // true: writes error messages
  bool m_bInfoMode;   // true: writes info messages
  bool m_bColors;
  FILE *m_pOutputFile;// log file for filemode

  // This Class is a singleton, so Log constructor is private
  Log();

 public:    
  ~Log();
  void  freeMemory();
  void debug(const char * _string, ...);
  void info(const char * _string, ...);
  void error(const char * _string, ...);
  static Log& getInstance();
  
  /*--------------------------------
    Set Functions
  ---------------------------------*/
  inline void setFileMode(bool _value){m_bFileMode=_value;}
  inline void setColors(bool _value){m_bColors=_value;}
  inline void setDebugMode(bool _value){m_bDebugMode=_value;}
  inline void setInfoMode(bool _value){m_bInfoMode=_value;}   
  inline void setErrorMode(bool _value){m_bErrorMode=_value;}   
};
#endif
